package xFGE.xDisplay.xUI
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	public class xComboBox extends Sprite
	{
		private var _lable:TextField;
		
		private var _btn:xButton;
		public function xComboBox() 
		{
			super();
			InitView();
		}
		
		public function InitView():void
		{
			_lable = getChildByName("lable") as TextField;
			addChild(_lable);
			_btn = getChildByName("btn") as xButton;
			_btn.addEventListener(MouseEvent.CLICK,_onClick);
			addChild(_btn);
		}
		
		public function SetDisable(flag:Boolean):void
		{
			mouseEnabled = flag;
			_btn.mouseEnabled = flag;
		}
		
		public function SetLable(text:String):void
		{
			_lable.text = text;
		}
		
		public function GetLable():String
		{
			return _lable.text;
		}
		
		public function SetSelected(flag:Boolean):void
		{
			_btn.SetSelected(flag);
		}
		
		public function hasSelected():Boolean
		{
			return _btn.hasSelected();
		}
		
		private function _onClick(eve:MouseEvent):void
		{
			_dispatchEvent();
		}
		
		private function _dispatchEvent():void
		{
			this.dispatchEvent(new Event("select_change"));
		}
	}
}